package com.neu.api.mapper;

import com.neu.api.pojo.Food;
import com.neu.api.query.FoodQuery;
import com.neu.api.vo.FoodVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FoodMapper {
    //mybatis
       //注解
       //映射文件

    //@Select("select id,name from t_food ")
    public List<FoodVO> find();

    public void add(Food food);

    /**
     * 菜品查询
     * @param foodQuery
     * @return
     */
    List<FoodVO> find(FoodQuery foodQuery);

    @Select("select count(*) from t_food where category_id = #{categoryId}")
    int findCountByCategoryId(long categoryId);

    /**
     * 编辑菜品
     * @param food
     */
    void update(Food food);

    /**
     * 删除菜品，根据id
     */
    @Delete("delete from t_food where id = #{id}")
    void deleteById(long id);


    /**
     * 根据id查询
     * @param id
     * @return
     */
    FoodVO findById(long id);

}